﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DataAccess;
using BaseEntities;

namespace BussinessLogic
{
    public class AccountBLL
    {
        DataAccess.DataAccess DB = new DataAccess.DataAccess();
        public decimal GetBalance(int ID)
        {
            string query = "EXEC [GetBalance] @ID";
            SqlParameter paramID = new SqlParameter("@ID", ID);
            Account acc = new Account();
            acc.Balance = DB.GetBalance(query, paramID);
            return acc.Balance;
        }
        public void UpdateBalance(int AccountID, decimal Amount)
        {
            string query = "EXEC [UpdateBalance] @AccountID, @Amount";
            SqlParameter paramAccountID = new SqlParameter("@AccountID", AccountID);
            SqlParameter paramAmount = new SqlParameter("@Amount", Amount);
            DB.UpdateData(query, paramAccountID, paramAmount);
        }
    }
}
